<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>添加人员</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <link rel="stylesheet" href="../../static/css/font.css" th:href="@{/css/font.css}">
    <link rel="stylesheet" href="../../static/css/xadmin.css" th:href="@{/css/xadmin.css}">
    <link rel="stylesheet" href="../../static/css/all-member.css" th:href="@{/css/all-member.css}">
    <style>
        .star {
            color: red;
        }
    </style>
</head>

<body>
    <div style="overflow-y:scroll;" id="form-container" th:with="user=${checkUser}">
        <form class="layui-form layui-form-pane">
            <!--<div class="layui-form-item" style="position: relative;right:100px;top: 10px;">-->
            <!--</div>-->
            <div style="display: flex;">
                <div class="part">
                    <div class="layui-form-item">
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>姓名:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="name" autocomplete="off" class="layui-input" lay-verify="required">
                        </div>
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>性别:</label>
                        <div class="layui-input-inline">
                            <select name="gender" lay-filter="gender" lay-verify="required">
                                <option value="">请选择一个性别</option>
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                        </div>
                    </div>
                    <!-- 第一行 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>出生日期:</label>
                        <div class="layui-input-inline">
                            <input name="birthday" id="birthday" type="text" autocomplete="off" lay-verify="required"
                                class="layui-input">
                        </div>
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>民族:</label>
                        <div class="layui-input-inline">
                            <select name="nation" lay-filter="nation" lay-verify="required" id="nation">
                                <option value="">请选择一个民族</option>
                            </select>
                        </div>
                    </div>
                    <!-- 第二行 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">文化程度:</label>
                        <div class="layui-input-inline">
                            <select name="educationalLevel" lay-filter="educationalLevel">
                                <option value="">请选择文化程度</option>
                                <option value="初中">初中</option>
                                <option value="高中">高中</option>
                                <option value="大专">大专</option>
                                <option value="中专">中专</option>
                            </select>
                        </div>
                        <label class="layui-form-label">专业:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="major" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <!-- 第三行 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>身份证号:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="idCardNum" autocomplete="off" class="layui-input" lay-verify="required">
                        </div>
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>政治面貌:</label>
                        <div class="layui-input-inline">
                            <select name="politicalStatus" lay-filter="politicalStatus" lay-verify="required">
                                <option value="">请选择政治面貌</option>
                                <option value="团员">团员</option>
                                <option value="党员">党员</option>
                                <option value="群众">群众</option>
                                <option value="其他">其他</option>
                            </select>
                        </div>
                    </div>

                    <!-- 第四行 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label"><i class="star">*&nbsp;</i>手机号码:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="phoneNum" autocomplete="off" class="layui-input" lay-verify="required">
                        </div>
                        <label class="layui-form-label">电子邮箱:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="email" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>


                <div class="layui-input-block" style="position: relative;">
                    <button id="upload1" type="button"
                        style="position:absolute;opacity:0;height:160px;width:120px;"></button>
                    <button id="hideupload1" type="button" class="layui-hide"></button>
                    <img id="imgPhoto" src="" style="width:120px;height:160px;">
                </div>
            </div>

            <!-- 第五行 -->
            <div class="layui-form-item">
                <label class="layui-form-label">QQ号:</label>
                <div class="layui-input-inline">
                    <input type="text" name="qqNum" autocomplete="off" class="layui-input">
                </div>
                <label class="layui-form-label">微信号:</label>
                <div class="layui-input-inline">
                    <input type="text" name="wechatNum" autocomplete="off" class="layui-input">
                </div>
            </div>

            <!-- 第六行 -->
            <div class="layui-form-item">
                <label class="layui-form-label" style="padding:8px 10px"><i class="star">*&nbsp;</i>户籍所在地:</label>
                <div class="layui-input-inline" style="width: 180px;">
                    <select name="province" id="province" lay-filter="province" lay-verify="required">
                        <option value="">请选择省份</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width: 180px;">
                    <select name="city" id="city" lay-filter="city" lay-verify="required">
                        <option value="">请选择市</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width: 180px;">
                    <select name="district" id="district" lay-filter="district" lay-verify="required">
                        <option value="">请选择区</option>
                    </select>
                </div>
                <div class="layui-input-inline" style="width: 180px;">
                    <select name="town" id="town" lay-filter="town" lay-verify="required">
                        <option value="">请选择镇</option>
                    </select>
                </div>
            </div>

            <!--第七行-->
            <div class="layui-form-item">
                <label class="layui-form-label"><i class="star">*&nbsp;</i>通讯地址:</label>
                <div class="layui-input-block">
                    <input type="text" name="address" autocomplete="off" class="layui-input" lay-verify="required">
                </div>
            </div>

            <!-- 第八行 -->
            <div class="layui-form-item">
                <label class="layui-form-label"><i class="star">*&nbsp;</i>人员类别:</label>
                <div class="layui-input-inline" lay-filter="select-user-type">
                    <select name="userType" id="userType" lay-verify="required">
                        <!-- <option value="" th:each="type : ${allUserType}" th:text="${type.userTypeName}" th:selected="${user.userType.id == type.id}">请选择人员类别</option> -->
                        <!--                                        <option value="1" th:text="${user.userType.id == '2'}">1</option>-->
                        <!--                    <option value="2">2</option>-->
                        <!--                    <option value="3">3</option>-->
                        <option value="">请选择人员类别</option>

                    </select>
                </div>
                <label class="layui-form-label"><i class="star">*&nbsp;</i>申请方式:</label>
                <div class="layui-input-inline">
                    <select name="applicationMethod" id="applicationMethod" lay-verify="required">
                        <option value="">请选择申请方式</option>
                    </select>
                </div>
            </div>


            <!--第九行-->
            <div class="layui-form-item">
                <label class="layui-form-label"
                    style="height: 114px;padding: 8px 10px;line-height: 114px;vertical-align: middle">学习培训经历:</label>
                <div class="layui-input-block">
                    <label class="layui-form-label"
                        style="height: 76px;line-height: 76px;vertical-align: middle">地方培训:</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid" style="margin-right: 5px">是否参加地方农业培训</div>
                        <div class="layui-input-inline" style="width: 160px">
                            <select name="isAttendLocalTraining" class="local">
                                <option value="">请选择是否参加</option>
                                <option value="true">是</option>
                                <option value="false">否</option>
                            </select>
                        </div>
                        <div class="layui-form-mid" style="margin-right: 5px">,平均每年参加地方培训</div>
                        <div class="layui-input-inline" style="width: 160px">
                            <select name="localTrainingTimes" class="local">
                                <option value="">请选择次数</option>
                                <option value="1">1</option>
                                <option value="2">2</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-input-block">
                        <input type="text" name="localTrainingDescription" autocomplete="off" class="layui-input">
                    </div>
                    <label class="layui-form-label">国家培训:</label>
                    <div class="layui-input-block">
                        <input type="text" name="nationalTrainingDescription" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>

            <!--第十行-->
            <div class="layui-form-item">
                <label class="layui-form-label" style="padding: 8px 3px"><i class="star" >*&nbsp;</i>获奖证书情况:</label>
                <div class="layui-input-block">
                    <select name="certificates" class="local" id="certificates" lay-verify="required">
                        <option value="">请选择获奖证书情况</option>
                    </select>
                </div>
            </div>

            <!--第十一行-->
            <div class="layui-form-item">
                <label class="layui-form-label"><i class="star">*&nbsp;</i>认定情况:</label>
                <div class="layui-input-inline">
                    <select name="identification" lay-filter="culture" lay-verify="required">
                        <option value="">请选择认定情况</option>
                        <option value="true">已认定</option>
                        <option value="false">未认定</option>
                    </select>
                </div>
                <label class="layui-form-label" style="width:190px;">新型职业农民证书编号:</label>
                <div class="layui-input-inline">
                    <input type="text" name="identificationNum" autocomplete="off" class="layui-input">
                </div>
                <!--<div class="layui-form-mid">辅助文字</div>-->
            </div>

            <!--第十二行-->
            <div class="layui-form-item">
                <label class="layui-form-label">类型变更:</label>
                <div class="layui-input-block">
                    <select name="typeChange" class="local">
                        <option value="">请选择类型变更</option>
                        <option value="类型1">类型1</option>
                        <option value="类型2">类型2</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <span class="layui-form-label" style="height: 492px;padding: 8px 30px;white-space: normal;">农业生产经营和服务基本情况</span>
                <div class="layui-input-block">
                    <span class="layui-form-label">产业所在地</span>
                    <div class="layui-input-block">
                        <input class="layui-input" type="text" name="industryDirection" autocomplete="off" />
                    </div>
                    <div class="layui-input-block" style="left:-110px;width: 100%;text-align: center;line-height:36px;vertical-align: middle;">主体产业</div>
                    <div class="layui-input-block" style="left:-110px;width: 100%">
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">主体产业1</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryType_1" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryName_1" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryScale_1" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="year_1" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                    </div>
                    <div class="layui-input-block" style="left:-110px;width: 100%">
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">主体产业2</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryType_2" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryName_2" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryScale_2" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="year_2" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                    </div>
                    <div class="layui-input-block" style="left:-110px;width: 100%">
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">主体产业3</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryType_3" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业名称</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryName_3" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">产业规模</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="industryScale_3" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                        <span class="layui-form-label" style="width: 85px;padding: 8px 8px">从事年限</span>
                        <div class="layui-input-inline" style="width: 105px;margin-right: 2px">
                            <input class="layui-input" type="text" name="year_3" autocomplete="off"
                                style="padding-left: 7px" />
                        </div>
                    </div>
                    <div class="layui-input-block" style="left: -110px;width: 100%">
                        <span class="layui-form-label" style="padding: 8px 3px;">上年度产业收入</span>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" name="incomeOfLastYear_industry"
                                autocomplete="off" />
                        </div>
                    </div>
                    <div class="layui-input-block" style="margin-left: 0;width: 100%">
                        <span class="layui-form-label" name="familyFarmInfo" style="height: 152px;padding: 8px 3px;">家庭农场情况</span>
                        <div class="layui-input-block">
                            <span class="layui-form-label" style="padding: 8px 3px;">是否登记注册</span>
                            <div class="layui-input-inline">
                                <select name="register">
                                    <option value="">请选择是否注册</option>
                                    <option value="true">是</option>
                                    <option value="false">否</option>
                                </select>
                            </div>
                            <span class="layui-form-label" style="padding: 8px 3px;">示范性家庭农场</span>
                            <div class="layui-input-inline">
                                <select name="exemplaryFarm">
                                    <option value="">请选择是否为</option>
                                    <option value="true">是</option>
                                    <option value="false">否</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <span class="layui-form-label" style="padding: 8px 3px;">家庭农场类型</span>
                            <div class="layui-input-block">
                                <input name="farmType" class="layui-input" type="text" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <span class="layui-form-label" style="padding: 8px 3px;">土地经营规模</span>
                            <div class="layui-input-inline">
                                <input name="landManagementScale" class="layui-input" type="text" autocomplete="off">
                            </div>
                            <span class="layui-form-label" >家庭总人口</span>
                            <div class="layui-input-inline">
                                <input name="population" class="layui-input" type="text" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <span class="layui-form-label" style="padding: 8px 0px;width: 120px;">家庭从事产业人数</span>
                            <div class="layui-input-inline" style="width: 180px;">
                                <input name="engagedNum" class="layui-input" type="text" autocomplete="off">
                            </div>
                            <span class="layui-form-label" style="padding: 8px 3px;">上年度家庭收入</span>
                            <div class="layui-input-inline">
                                <input name="incomeOfLastYear_family" class="layui-input" type="text"
                                    autocomplete="off">
                            </div>
                        </div>


                        <div class="layui-input-block" style="left: -110px">
                            <span class="layui-form-label">工作地点</span>
                            <div class="layui-input-block">
                                <input name="workAddress" class="layui-input" type="text" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-input-block" style="left: -110px">
                            <span class="layui-form-label">服务对象</span>
                            <div class="layui-input-inline">
                                <input name="serviceTarget" class="layui-input" type="text" autocomplete="off">
                            </div>
                            <span class="layui-form-label">服务规模</span>
                            <div class="layui-input-inline">
                                <input name="serviceCount" class="layui-input" type="text" autocomplete="off">
                            </div>
                        </div>
                        <div class="layui-input-block" style="left: -110px">
                            <span class="layui-form-label">从业年限</span>
                            <div class="layui-input-inline">
                                <input name="year_total" class="layui-input" type="text" autocomplete="off">
                            </div>
                            <span class="layui-form-label">年收入</span>
                            <div class="layui-input-inline">
                                <input name="income_total" class="layui-input" type="text" autocomplete="off">
                            </div>

                        </div>
                    </div>
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block" style="float:right;padding-right: 20px">
                    <button class="layui-btn" lay-submit lay-filter="formAdd">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>

    <script type="text/javascript" src="../../static/lib/layui/layui.js" charset="utf-8"
        th:src="@{/lib/layui/layui.js}"></script>
    <script type="text/javascript" src="../../static/js/xadmin.js" th:src="@{/js/xadmin.js}"></script>
    <script type="text/javascript" src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
    <!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
    <script th:inline="NONE">
        $('#form-container').css('height', $(window).height() + 'px');
        layui.use(['form', 'table', 'laydate'], function () {
            var form = layui.form;
            var laydate = layui.laydate;
            var res = JSON.parse(sessionStorage.getItem('province'));
            var length = res.districts[0].districts.length;
            var nations = ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族", "布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族",
		"土家族", "哈尼族", "哈萨克族", "傣族", "黎族", "傈僳族", "佤族", "畲族", "高山族", "拉祜族", "水族", "东乡族", "纳西族", "景颇族", "柯尔克孜族", "土族", 
		"达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族", "乌孜别克族", "俄罗斯族", "鄂温克族", 
		"德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族", "基诺族"];
       
            for (var i = 0; i < length; i++) {
                $("#province").append(
                    "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                );
            }
            for(var item of nations){
                    $("#nation").append(
                        "<option value=\"" + item + "\" >" + item + "</option>"
                    );
                }

            function changeLocation(thisIdSelector, nextIdSelector) {
                form.on(thisIdSelector, function (data) {
                    // category = data.value;
                    thisLocation = data.elem[data.elem.selectedIndex].text;
                    console.log(thisLocation);
                    $.ajax({
                        url: "https://restapi.amap.com/v3/config/district?key=e9b4199596ccf074d1480b0236a60b06&subdistrict=1&keywords=" + thisLocation,
                        type: "GET",
                        success: function (res) {
                            var length = res.districts[0].districts.length;
                            console.log("length", length);
                            $(nextIdSelector).empty();
                            for (var i = 0; i < length; i++) {
                                $(nextIdSelector).append(
                                    "<option value=\"" + res.districts[0].districts[i].name + "\" >" + res.districts[0].districts[i].name + "</option>"
                                );
                            }
                            form.render('select');

                        }, error: function (res) {
                            console.log("失败了");
                        }
                    })
                    form.render('select');
                })
            }

            changeLocation('select(province)', '#city');
            changeLocation('select(city)', '#district');
            changeLocation('select(district)', '#town');


            laydate.render({
                elem: '#birthday'
            });
            function renderOptions(url, name, selector) {
                $.ajax({
                    url: url,
                    type: 'GET',
                    success: function (res) {
                        console.log("用户类型", res);
                        var data = res.data;
                        $.each(data, function (index, item) {
                            $(selector).append('<option value="' + item[name] + '" data-desc="' + item.description + '" data-id="' + item.id + '">' + item[name] + '</option>');
                        });
                        form.render();
                    }
                });
            }
            renderOptions('/v1/userType/getAllUserType', 'userTypeName', '#userType');
            renderOptions('/v1/applicationMethod/getAllApplicationMethod', 'applicationMethodName', '#applicationMethod');
            renderOptions('/v1/certificate/getAllCertificate', 'certificateName', '#certificates');
            form.render();
            form.on('submit(formAdd)', function (data) {
                console.log($('#user-type'));
                console.log(JSON.stringify(data.field));
                var data = data.field;
                console.log(data);
                var newData = data;
                console.log(newData);
                function newObject(keyName, selector, selectName) {
                    var res = {};
                    if (data[selectName]) {
                        res[keyName] = $(selector).attr("value");
                        res.description = $(selector).attr("data-desc");
                        res.id = $(selector).attr("data-id");
                    }
                    return res;
                }
                var applicationMethod = newObject("applicationMethodName", "#applicationMethod option:selected", "applicationMethod");
                var certificates = newObject("certificatesName", "#certificates option:selected", "certificates");
                var userType = newObject("userTypeName", "#userType option:selected", "userType");
                console.log("applicationMethod", applicationMethod);
                console.log("certificates", certificates);
                console.log("userType", userType);
                var industryBaseInfo = {};
                var familyFarmInfo = {};
                familyFarmInfo.engagedNum = data.engagedNum ? parseInt(data.engagedNum) : null;
                familyFarmInfo.exemplaryFarm = data.exemplaryFarm ? JSON.parse(data.exemplaryFarm) : null;
                familyFarmInfo.farmType = data.farmType ? data.farmType : "";
                familyFarmInfo.incomeOfLastYear = data.incomeOfLastYear_family ? parseInt(data.incomeOfLastYear_family) : null;
                familyFarmInfo.landManagementScale = data.landManagementScale ? parseInt(data.landManagementScale) : null;
                familyFarmInfo.register = data.register ? JSON.parse(data.register) : null;
                familyFarmInfo.population = data.population ? parseInt(data.population) : null;
                var industries = [];
                var industry1 = {}, industry2 = {}, industry3 = {};
                if (data.industryType_1) {
                    industry1.industryName = data.industryName_1;
                    industry1.industryScale = data.industryScale_1 ? parseInt(data.industryScale_1) : null;
                    industry1.industryType = data.industryType_1;
                    industry1.year = data.year_1 ? parseInt(data.year_1) : null;
                    industries.push(industry1)
                }
                if (data.industryType_2) {
                    industry2.industryName = data.industryName_2;
                    industry2.industryScale = data.industryScale_2 ? parseInt(data.industryScale_2) : null;
                    industry2.industryType = data.industryType_2;
                    industry2.year = data.year_2 ? parseInt(data.year_2) : null;
                    industries.push(industry2)
                }
                if (data.industryType_3) {
                    industry3.industryName = data.industryName_3;
                    industry3.industryScale = data.industryScale_3 ? parseInt(data.industryScale_3) : null;
                    industry3.industryType = data.industryType_3;
                    industry3.year = data.year_3 ? parseInt(data.year_3) : null;
                    industries.push(industry3)
                }
                industryBaseInfo.familyFarmInfo = familyFarmInfo;
                industryBaseInfo.industries = industries;
                industryBaseInfo.income = data.income_total ? parseInt(data.income_total) : null;
                industryBaseInfo.incomeOfLastYear = data.incomeOfLastYear_industry ? data.incomeOfLastYear_industry : null;
                industryBaseInfo.industryDirection = data.industryDirection ? data.industryDirection : "";
                industryBaseInfo.serviceCount = data.serviceCount ? parseInt(data.serviceCount) : null;
                industryBaseInfo.serviceTarget = data.industryDirection ? data.industryDirection : "";
                industryBaseInfo.workAddress = data.workAddress ? data.workAddress : "";
                industryBaseInfo.year = data.year_total ? parseInt(data.year_total) : null;

                var tempArr = [];
                tempArr.push(certificates);
                newData.identification = data.identification ? JSON.parse(data.identification) : null;
                newData.industryBaseInfo = industryBaseInfo;
                newData.applicationMethod = applicationMethod;
                newData.certificates = tempArr;
                newData.userType = userType;
                newData.faceImage = "";
                newData.nationalTrainingTimes = 0;
                newData.localTrainingTimes = newData.localTrainingTimes ? parseInt(newData.localTrainingTimes) : null;
                newData.isAttendLocalTraining = newData.isAttendLocalTraining ? JSON.parse(newData.isAttendLocalTraining) : null;
                delete newData.incomeOfLastYear_industry;
                delete newData.income_total;
                delete newData.incomeOfLastYear_family;
                delete newData.year_total;
                delete newData.year_1;
                delete newData.year_2;
                delete newData.year_3;
                delete newData.industryType_1;
                delete newData.industryType_2;
                delete newData.industryType_3;
                delete newData.industryName_1;
                delete newData.industryName_2;
                delete newData.industryName_3;
                delete newData.industryScale_1;
                delete newData.industryScale_2;
                delete newData.industryScale_3;
                delete newData.engagedNum;
                delete newData.exemplaryFarm;
                delete newData.farmType;
                delete newData.landManagementScale;
                delete newData.register;
                delete newData.industryDirection;
                delete newData.workAddress;
                delete newData.serviceTarget;
                delete newData.serviceCount;
                delete newData.population;


                console.log("newData", newData);

                $.ajax({
                    url: '/v1/user/addUser',
                    contentType: 'application/json',
                    type: 'POST',
                    async: false,
                    data: JSON.stringify(newData),
                    success: function (res) {
                        console.log("成功了");
                        layer.msg("成功了");
                        // layer.closeAll();
                    }, error: function (res) {
                        console.log("失败", res.msg);
                        layer.msg("失败了");
                    }, complete: function (res) {
                        console.log("完成", res);
                    }
                })
            })

        })

    </script>
</body>

</html>